| tle: “Estado del COVID-19 en Costa Rica” |
| thor: “ING. Juan Miguel Víquez R” |
| tput: |
| flexdashboard::flex_dashboard: |
| orientation: rows |
| social: menu |
| source_code: embed |
| vertical_layout: fill |
valueBox(value = paste(format(df_general_pais_ultima_fecha$positivos, big.mark = ","), "", sep = " "),
caption = "Total de casos positivos",
icon = icono_positivos,
color = color_positivos
)
118,566
valueBox(value = paste(format(df_general_pais_ultima_fecha$activos, big.mark = ","), " (",
round(100 * df_general_pais_ultima_fecha$activos / df_general_pais_ultima_fecha$positivos, 1),
"%)", sep = ""),
caption = "Total de casos activos",
icon = icono_positivos,
color = color_activos
)
44,123 (37.2%)
valueBox(value = paste(format(df_general_pais_ultima_fecha$RECUPERADOS, big.mark = ","), " (",
round(100 * df_general_pais_ultima_fecha$RECUPERADOS / df_general_pais_ultima_fecha$positivos, 1),
"%)", sep = ""),
caption = "Total de casos recuperados",
icon = icono_positivos,
color = color_recuperados
)
72,941 (61.5%)
valueBox(value = paste(format(df_general_pais_ultima_fecha$fallecidos, big.mark = ","), " (",
round(100 * df_general_pais_ultima_fecha$fallecidos / df_general_pais_ultima_fecha$positivos, 1),
"%)", sep = ""),
caption = "Total de casos fallecidos",
icon = icono_positivos,
color = color_fallecidos
)
1,502 (1.3%)
valueBox(value = paste(format(df_general_pais_ultima_fecha$hospital, big.mark = ","), "", sep = " "),
caption = "Total de hospitalizados",
icon = icono_hospitalizados,
color = color_hospitalizados
)
492
valueBox(value = paste(format(df_general_pais_ultima_fecha$salon, big.mark = ","), " (",
round(100 * df_general_pais_ultima_fecha$salon / df_general_pais_ultima_fecha$hospital, 1),
"%)", sep = ""),
caption = "Hospitalizados en salón",
icon = icono_salon,
color = color_salon
)
294 (59.8%)
valueBox(value = paste(format(df_general_pais_ultima_fecha$UCI, big.mark = ","), " (",
round(100 * df_general_pais_ultima_fecha$UCI / df_general_pais_ultima_fecha$hospital, 1),
"%)", sep = ""),
caption = "Hospitalizados en UCI",
icon = icono_uci,
color = color_uci
)
198 (40.2%)
plot_ly(data = df_general_pais,
x = ~ FECHA,
y = ~ positivos,
name = 'Positivos',
type = 'scatter',
mode = 'lines',
line = list(color = color_positivos)) %>%
add_trace(y = ~ activos,
name = 'Activos',
mode = 'lines',
line = list(color = color_activos)) %>%
add_trace(y = ~ RECUPERADOS,
name = 'Recuperados',
mode = 'lines',
line = list(color = color_recuperados)) %>%
add_trace(y = ~ fallecidos,
name = 'Fallecidos',
mode = 'lines',
line = list(color = color_fallecidos)) %>%
layout(title = "",
yaxis = list(title = "Cantidad de casos"),
xaxis = list(title = "Fecha"),
legend = list(x = 0.1, y = 0.9),
hovermode = "compare")
## Warning: `arrange_()` is deprecated as of dplyr 0.7.0.
## Please use `arrange()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.
st_drop_geometry(sf_positivos_cantones_ultima_fecha) %>%
select(Provincia = provincia, Canton = canton, Positivos = positivos) %>%
DT::datatable(rownames = FALSE,
options = list(searchHighlight = TRUE,
language = list(url = '//cdn.datatables.net/plug-ins/1.10.11/i18n/Spanish.json')
)
)
valueBox(value = paste(format(df_general_pais_ultima_fecha$positivos, big.mark = ","), "", sep = " "),
caption = "Total de casos positivos",
icon = icono_positivos,
color = color_positivos
)
118,566
paleta_azul <- colorBin(palette = "Blues",
domain = sf_positivos_cantones_ultima_fecha$positivos,
bins = 10
)
leaflet_cantonespositivos <- leaflet(sf_positivos_cantones_ultima_fecha) %>%
fitBounds(lng1 = -86, lng2 = -82, lat1 = 8, lat2 = 11) %>%
addProviderTiles(providers$OpenStreetMap.Mapnik, group = "OpenStreetMap") %>%
addPolygons(fillColor = ~paleta_azul(positivos), stroke=T, fillOpacity = 1,
color="black", weight=0.2, opacity= 0.5,
group = "Cantones",
popup = paste("Provincia: ", sf_positivos_cantones_ultima_fecha$provincia, "<br>",
"Cantón: ", sf_positivos_cantones_ultima_fecha$canton, "<br>",
"Positivos: ", sf_positivos_cantones_ultima_fecha$positivos
)
) %>%
addLegend("bottomright", pal = paleta_azul, values = ~positivos,
title = "Casos positivos",
opacity = 1
) %>%
addLayersControl(
baseGroups = c("OpenStreetMap"),
overlayGroups = c("Cantones"),
options = layersControlOptions(collapsed = TRUE)
) %>%
addMiniMap(
toggleDisplay = TRUE,
position = "bottomleft",
tiles = providers$OpenStreetMap.Mapnik
)
## Warning in RColorBrewer::brewer.pal(max(3, n), palette): n too large, allowed maximum for palette Blues is 9
## Returning the palette you asked for with that many colors
## Warning in RColorBrewer::brewer.pal(max(3, n), palette): n too large, allowed maximum for palette Blues is 9
## Returning the palette you asked for with that many colors
# Despliegue del mapa
leaflet_cantonespositivos
st_drop_geometry(sf_positivos_cantones_ultima_fecha) %>%
mutate(canton = factor(canton, levels = canton)) %>%
top_n(n = 10, wt = positivos) %>%
plot_ly(x = ~ canton,
y = ~ positivos,
type = "bar",
text = ~ positivos,
textposition = 'auto',
marker = list(color = color_positivos)
) %>%
layout(yaxis = list(title = "Cantidad de casos positivos"),
xaxis = list(title = ""),
margin = list(l = 10,
r = 10,
b = 10,
t = 10,
pad = 2
)
)
valueBox(value = paste(format(df_general_pais_ultima_fecha$activos, big.mark = ","), "", sep = " "),
caption = "Total de casos activos",
icon = icono_activos,
color = color_activos
)
44,123 ### Mapa de casos positivos en cantones
paleta_roja <- colorBin(palette = "Reds",
domain = sf_activos_cantones_ultima_fecha$activos,
bins = 10
)
leaflet_cantonesactivos <- leaflet(sf_activos_cantones_ultima_fecha) %>%
fitBounds(lng1 = -86, lng2 = -82, lat1 = 8, lat2 = 11) %>%
addProviderTiles(providers$OpenStreetMap.Mapnik, group = "OpenStreetMap") %>%
addPolygons(fillColor = ~paleta_roja(activos), stroke=T, fillOpacity = 1,
color="black", weight=0.2, opacity= 0.5,
group = "Cantones",
popup = paste("Provincia: ", sf_activos_cantones_ultima_fecha$provincia, "<br>",
"Cantón: ", sf_activos_cantones_ultima_fecha$canton, "<br>",
"Positivos: ", sf_activos_cantones_ultima_fecha$activos
)
) %>%
addLegend("bottomright", pal = paleta_roja, values = ~activos,
title = "Casos activos",
opacity = 1
) %>%
addLayersControl(
baseGroups = c("OpenStreetMap"),
overlayGroups = c("Cantones"),
options = layersControlOptions(collapsed = TRUE)
) %>%
addMiniMap(
toggleDisplay = TRUE,
position = "bottomleft",
tiles = providers$OpenStreetMap.Mapnik
)
## Warning in RColorBrewer::brewer.pal(max(3, n), palette): n too large, allowed maximum for palette Reds is 9
## Returning the palette you asked for with that many colors
## Warning in RColorBrewer::brewer.pal(max(3, n), palette): n too large, allowed maximum for palette Reds is 9
## Returning the palette you asked for with that many colors
# Despliegue del mapa
leaflet_cantonesactivos
### Tabla de cantidades de casos en cantones
st_drop_geometry(sf_activos_cantones_ultima_fecha) %>%
select(Provincia = provincia, Canton = canton, Activos = activos) %>%
DT::datatable(rownames = FALSE,
options = list(searchHighlight = TRUE,
language = list(url = '//cdn.datatables.net/plug-ins/1.10.11/i18n/Spanish.json')
)
)
st_drop_geometry(sf_activos_cantones_ultima_fecha) %>%
mutate(canton = factor(canton, levels = canton)) %>%
top_n(n = 10, wt = activos) %>%
plot_ly(x = ~ canton,
y = ~ activos,
type = "bar",
text = ~ activos,
textposition = 'auto',
marker = list(color = color_activos)
) %>%
layout(yaxis = list(title = "Cantidad de casos activos"),
xaxis = list(title = ""),
margin = list(l = 10,
r = 10,
b = 10,
t = 10,
pad = 2
)
)
valueBox(value = paste(format(df_general_pais_ultima_fecha$recuperados, big.mark = ","), "", sep = " "),
caption = "Total de casos recuperados",
icon = icono_recuperados,
color = color_recuperados
)
NULL ### Mapa de casos recuperados en cantones
paleta_verde <- colorBin(palette = "viridis",
domain = sf_recuperados_cantones_ultima_fecha$recuperados,
bins = 10
)
leaflet_cantonesrecuperados <- leaflet(sf_recuperados_cantones_ultima_fecha) %>%
fitBounds(lng1 = -86, lng2 = -82, lat1 = 8, lat2 = 11) %>%
addProviderTiles(providers$OpenStreetMap.Mapnik, group = "OpenStreetMap") %>%
addPolygons(fillColor = ~paleta_verde(recuperados), stroke=T, fillOpacity = 1,
color="black", weight=0.2, opacity= 0.5,
group = "Cantones",
popup = paste("Provincia: ", sf_recuperados_cantones_ultima_fecha$provincia, "<br>",
"Cantón: ", sf_recuperados_cantones_ultima_fecha$canton, "<br>",
"Recuperados: ", sf_recuperados_cantones_ultima_fecha$recuperados
)
) %>%
addLegend("bottomright", pal = paleta_verde, values = ~recuperados,
title = "Casos recuperados",
opacity = 1
) %>%
addLayersControl(
baseGroups = c("OpenStreetMap"),
overlayGroups = c("Cantones"),
options = layersControlOptions(collapsed = TRUE)
) %>%
addMiniMap(
toggleDisplay = TRUE,
position = "bottomleft",
tiles = providers$OpenStreetMap.Mapnik
)
# Despliegue del mapa
leaflet_cantonesrecuperados
### Tabla de cantidades de casos en cantones
st_drop_geometry(sf_recuperados_cantones_ultima_fecha) %>%
select(Provincia = provincia, Canton = canton, Recuperados = recuperados) %>%
DT::datatable(rownames = FALSE,
options = list(searchHighlight = TRUE,
language = list(url = '//cdn.datatables.net/plug-ins/1.10.11/i18n/Spanish.json')
)
)
st_drop_geometry(sf_recuperados_cantones_ultima_fecha) %>%
mutate(canton = factor(canton, levels = canton)) %>%
top_n(n = 10, wt = recuperados) %>%
plot_ly(x = ~ canton,
y = ~ recuperados,
type = "bar",
text = ~ recuperados,
textposition = 'auto',
marker = list(color = color_recuperados)
) %>%
layout(yaxis = list(title = "Cantidad de casos recuperados"),
xaxis = list(title = ""),
margin = list(l = 10,
r = 10,
b = 10,
t = 10,
pad = 2
)
)
valueBox(value = paste(format(df_general_pais_ultima_fecha$fallecidos, big.mark = ","), "", sep = " "),
caption = "Total de fallecidos",
icon = icono_fallecidos,
color = color_fallecidos
)
1,502 ### Mapa de casos positivos en cantones
paleta_morada <- colorBin(palette = "Heat",
domain = sf_fallecidos_cantones_ultima_fecha$fallecidos,
bins = 10
)
leaflet_cantonesfallecidos <- leaflet(sf_fallecidos_cantones_ultima_fecha) %>%
fitBounds(lng1 = -86, lng2 = -82, lat1 = 8, lat2 = 11) %>%
addProviderTiles(providers$OpenStreetMap.Mapnik, group = "OpenStreetMap") %>%
addPolygons(fillColor = ~paleta_morada(fallecidos), stroke=T, fillOpacity = 1,
color="black", weight=0.2, opacity= 0.5,
group = "Cantones",
popup = paste("Provincia: ", sf_fallecidos_cantones_ultima_fecha$provincia, "<br>",
"Cantón: ", sf_fallecidos_cantones_ultima_fecha$canton, "<br>",
"Fallecidos: ", sf_fallecidos_cantones_ultima_fecha$fallecidos
)
) %>%
addLegend("bottomright", pal = paleta_morada, values = ~fallecidos,
title = "Casos fallecidos",
opacity = 1
) %>%
addLayersControl(
baseGroups = c("OpenStreetMap"),
overlayGroups = c("Cantones"),
options = layersControlOptions(collapsed = TRUE)
) %>%
addMiniMap(
toggleDisplay = TRUE,
position = "bottomleft",
tiles = providers$OpenStreetMap.Mapnik
)
# Despliegue del mapa
leaflet_cantonesfallecidos
### Tabla de cantidades de casos en cantones
st_drop_geometry(sf_fallecidos_cantones_ultima_fecha) %>%
select(Provincia = provincia, Canton = canton, Fallecidos= fallecidos) %>%
DT::datatable(rownames = FALSE,
options = list(searchHighlight = TRUE,
language = list(url = '//cdn.datatables.net/plug-ins/1.10.11/i18n/Spanish.json')
)
)
st_drop_geometry(sf_fallecidos_cantones_ultima_fecha) %>%
mutate(canton = factor(canton, levels = canton)) %>%
top_n(n = 10, wt = fallecidos) %>%
plot_ly(x = ~ canton,
y = ~ fallecidos,
type = "bar",
text = ~ fallecidos,
textposition = 'auto',
marker = list(color = color_fallecidos)
) %>%
layout(yaxis = list(title = "Cantidad de fallecidos"),
xaxis = list(title = ""),
margin = list(l = 10,
r = 10,
b = 10,
t = 10,
pad = 2
)
)